package com.example.controller;

import com.example.common.enums.ResponseCodeEnum;
import com.example.common.utils.ApiResult;
import com.example.model.query.TPlanRecordQuery;
import com.example.service.TPlanRecordService;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;

/**
 * 预案执行记录表
 * @author zhangr
 * @Description Created on 2020-12-23
 */

@RestController
@Controller
@RequestMapping("/tPlanRecord")
@Api(value = "预案执行记录管理",tags={"预案执行记录管理接口"})
public class TPlanRecordController {


    @Autowired
    private TPlanRecordService planRecordService;

    @GetMapping("/page")
    public ApiResult<TPlanRecordQuery> page(TPlanRecordQuery query){
        try {
            if(StringUtils.isBlank(query.getWarningId())){
                return new ApiResult<>(-1,"告警编号不能为空");
            }
            return planRecordService.pageUserVoByQuery(query);
        }   catch (Exception e) {
            e.printStackTrace();
            return new ApiResult<>(ResponseCodeEnum.MALL_SERVICE_PAGE_AD_FALSE);
        }
    }
}

